import Https from '@/utils/https'

// taskLog
const taskLog = (params) => Https.get('/api/v1/offlineDev/task/log', params)
// 停止任务
const stopTask = (params) => Https.post('/api/v1/offlineDev/task/stop', params, { json: false })
// 锁定脚本
const lockTask = (params) => Https.post('/api/v1/offlineDev/task/lock', params, { json: false })
// 获取节点的脚本内容
const getScript = (params) => Https.get('/api/v1/offlineDev/task/script/detail', params)
// 保存任务脚本
const saveScript = (params) => Https.post('/api/v1/offlineDev/task/script/save', params, { needCode: true })
// 启动任务
const startScript = (params) => Https.post('/api/v1/offlineDev/task/sql/start', params, { needCode: true })
// 获取作业树
const getWorkTree = () => Https.get('/api/v1/offlineDev/node/listAll', { id: 1 })

const tableList = () => Https.get('/api/v1/offlineDev/task/table/list')

export {
  taskLog, stopTask, lockTask, getScript, saveScript, startScript, getWorkTree, tableList,
}
